package com.ruoyi.web.controller.project;


import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.project.mapper.ProMeetingMapper;
import com.ruoyi.project.vo.ProMeetingEcharts;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/project/meetingbing")
public class ProMeetingEchartsController extends BaseController {
    @Autowired
    private ProMeetingMapper proMeetingMapper;

    @GetMapping("/meetingpie")
    public AjaxResult meetingpie(){
        List<ProMeetingEcharts> promeeting = proMeetingMapper.selectMeeting();
        ArrayList<ProMeetingEcharts> promeetingEcharts = new ArrayList<>();
        for(ProMeetingEcharts echarts: promeeting){
            ProMeetingEcharts promeetingEcharts1 = new ProMeetingEcharts();
            promeetingEcharts1.setName(echarts.getName());
            promeetingEcharts1.setValue(echarts.getValue());
            promeetingEcharts.add(promeetingEcharts1);
        }
        for(ProMeetingEcharts promeetingEchart : promeetingEcharts) {
            System.out.println("饼状图数据"+"=========="+promeetingEchart.getName()+promeetingEchart.getValue());
        }

        return AjaxResult.success(promeetingEcharts);
    }
}
